﻿(function ($) {

  $.fn.fullImages = function (fisher) {
    var fisher = $.extend({
      autoplay: null,
      images: null,
      hiddenOpacity: null,
      showOpacity: null
    }, fisher);

    var count = fisher.images.length;
    var nValue = 0;
    var _this = $(this);

    var setIntervalImg = setInterval(function () {
      nValue++;
      if (nValue === count) {
        nValue = 0;
      }
      _this.animate({opacity: fisher.hiddenOpacity}, 'slow', function () {
        $(this).css({
          'background-image': "linear-gradient(0deg, rgba(0, 0, 0, 0) 0%, rgba(21, 27, 38, 0.3) 100%)" +
              ", url('" + fisher.images[nValue] + "')"
        }).animate({opacity: fisher.showOpacity}, 'slow');
      });
    }, fisher.autoplay);
  };

}(jQuery));